<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html lang="cn zh">
<head >
    <meta charset="UTF-8">
    <title>生成订单</title>
    <link type="text/css" rel="stylesheet" href="${pageContext.request.contextPath}/css/order.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery-3.2.1.js"></script>
    <script>
        $(function () {
            var totalPrice=0;
            $(".price").each(function () {
                var price=parseFloat($(this).html())
                totalPrice+=price;
            })
            $("[colspan=\"5\"]").html(totalPrice)
        })
    </script>
</head>
<body>
    <div id="container"  align="center">
        <!--页面头部栏-->
        <div id="head">
            <iframe src="${pageContext.request.contextPath}/head.jsp" width="100%" height="100%" scrolling="no" frameborder="0">
            </iframe>
        </div>

        <!--注册信息栏-->
        <div id="center">
            <p id="p1">生成订单步骤：<span style="color:red">1.确认订单</span> > <span >2.填写送货地址</span>  >   <span>3.订单成功</span></p>
            <div id="order">
                <form method="post" action="">
                    <table border="1">
                        <thead>
                        <tr style="height: 50px"><th>序号</th><th>商品名称</th><th>商品单价</th><th>商品数量</th><th>小计</th></tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${cart}" var="book" varStatus="st">
                            <tr>
                                <td>${st.index+1}</td>
                                <td>${book.book}</td>
                                <td>${book.price}</td>
                                <td>${book.number}</td>
                                <td class="price">${book.price*book.number}</td>
                            </tr>
                        </c:forEach>
                        </tbody>
                        <tfoot>
                        <tr style="height: 50px"><td colspan="5">总价￥98.10</td></tr>
                        </tfoot>
                    </table>
                    <a href="${pageContext.request.contextPath}/login/cartServlet?doType=doQuery" ><input type="button" value="取消"></a>
                    <a href="/login/addressServlet?doType=doQuery&type=initData"><input type="button" value="下一步"></a>
                </form>
            </div>
        </div>

        <!--页面脚注栏-->
        <div id="foot">
            <iframe src="${pageContext.request.contextPath}/foot.jsp" width="100%" height="100%" scrolling="no" frameborder="0">
            </iframe>
        </div>
    </div>
</body>
</html>
